package only.my.railgunys.bean;

import only.my.railgunys.bean.db.Scene;

public class Character {
    int role ;
    Double hp = 0D;
    Integer level = 1;
    Double hp_ex= 0D;
    Double atk= 0D;
    Double atk_ex= 0D;
    Double critRate= 0D;
    Double critDmg= 0D;
    Double defense= 0D;
    Double defense_ex= 0D;
    Double healingBonus= 0D;
    Double increase= 0D;
    Double recharge= 0D;
    Double skillDmg= 0D;
    Double resistance=0D;
    Double reaction=1D;
    Double reactionIncrease=0D;


    boolean hpUseful ;
    boolean atkUseful;
    boolean critRateUseful;
    boolean defenseUseful;
    boolean rechargeUseful;
    boolean masteryUseful;
    boolean elementDmgUseful;
    boolean physicalDmgUseful;
    boolean healingBonusUseful;

    int sandType;
    int cupType;
    int circlet;

    int weapon;
    int weaponRefineLevel;
    String suit;

    Integer mastery=0;
    Integer totalDmg=0;
    public SubStatProperties subStatProperties;
    public Enemy enemy;

    String description;

    public int getRole() {
        return role;
    }

    public void setRole(int role) {
        this.role = role;
    }

    public Character(){
        this.subStatProperties = new SubStatProperties();
    }

    public Double getHp() {
        return hp;
    }

    public void setHp(Double hp) {
        this.hp = hp;
    }

    public Double getHp_ex() {
        return hp_ex;
    }

    public void setHp_ex(Double hp_ex) {
        this.hp_ex = hp_ex;
    }

    public Double getAtk() {
        return atk;
    }

    public void setAtk(Double atk) {
        this.atk = atk;
    }

    public Double getAtk_ex() {
        return atk_ex;
    }

    public void setAtk_ex(Double atk_ex) {
        this.atk_ex = atk_ex;
    }

    public Double getCritRate() {
        return critRate;
    }

    public void setCritRate(Double critRate) {
        this.critRate = critRate;
    }

    public Double getCritDmg() {
        return critDmg;
    }

    public void setCritDmg(Double critDmg) {
        this.critDmg = critDmg;
    }

    public Double getDefense() {
        return defense;
    }

    public void setDefense(Double defense) {
        this.defense = defense;
    }

    public Double getIncrease() {
        return increase;
    }

    public void setIncrease(Double increase) {
        this.increase = increase;
    }

    public Integer getMastery() {
        return mastery;
    }

    public void setMastery(Integer mastery) {
        this.mastery = mastery;
    }

    public Double getRecharge() {
        return recharge;
    }

    public void setRecharge(Double recharge) {
        this.recharge = recharge;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Double getSkillDmg() {
        return skillDmg;
    }

    public void setSkillDmg(Double skillDmg) {
        this.skillDmg = skillDmg;
    }

    public Integer getTotalDmg() {
        return totalDmg;
    }

    public Double getHealingBonus() {
        return healingBonus;
    }

    public void setHealingBonus(Double healingBonus) {
        this.healingBonus = healingBonus;
    }

    public void setTotalDmg(Integer totalDmg) {
        this.totalDmg = totalDmg;
    }

    public SubStatProperties getSubStatProperties() {
        return subStatProperties;
    }

    public void setSubStatProperties(SubStatProperties subStatProperties) {
        this.subStatProperties = subStatProperties;
    }

    public Enemy getEnemy() {
        return enemy;
    }

    public void setEnemy(Enemy enemy) {
        this.enemy = enemy;
    }

    public void addHp(Double hp0){
        this.hp_ex = hp_ex+hp0;
    }
    public void addAtk(Double atk0){
        this.atk_ex = atk_ex+atk*atk0/100;
    }
    public void addCritDmg(Double critDmg){
        this.critDmg = this.critDmg + critDmg;
    }
    public void addCritRate(Double critRate){
        this.critRate = this.critRate + critRate;
    }

    public Double getDefense_ex() {
        return defense_ex;
    }

    public void setDefense_ex(Double defense_ex) {
        this.defense_ex = defense_ex;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public void addDefense(Double defense){
        this.defense_ex =this.defense_ex+ this.defense * defense/100;
    }
    public void addMastery(Integer mastery){
        this.mastery = this.mastery +mastery;
    }
    public void addRecharge(Double recharge){
        this.recharge = this.recharge +recharge;
    }
    public void addIncrease(Double increase){
        this.increase = this.increase + increase;
    }
    public void addDescription(String description){
        this.description = this.description + description;
    }
    public void addHealingBonus(Double healingBonus){
        this.healingBonus = this.healingBonus + healingBonus;
    }

    public boolean isHealingBonusUseful() {
        return healingBonusUseful;
    }

    public void setHealingBonusUseful(boolean healingBonusUseful) {
        this.healingBonusUseful = healingBonusUseful;
    }

    public boolean isElementDmgUseful() {
        return elementDmgUseful;
    }

    public void setElementDmgUseful(boolean elementDmgUseful) {
        this.elementDmgUseful = elementDmgUseful;
    }

    public boolean isPhysicalDmgUseful() {
        return physicalDmgUseful;
    }

    public void setPhysicalDmgUseful(boolean physicalDmgUseful) {
        this.physicalDmgUseful = physicalDmgUseful;
    }

    public boolean isMasteryUseful() {
        return masteryUseful;
    }

    public void setMasteryUseful(boolean masteryUseful) {
        this.masteryUseful = masteryUseful;
    }

    public boolean isHpUseful() {
        return hpUseful;
    }

    public void setHpUseful(boolean hpUseful) {
        this.hpUseful = hpUseful;
    }

    public boolean isAtkUseful() {
        return atkUseful;
    }

    public void setAtkUseful(boolean atkUseful) {
        this.atkUseful = atkUseful;
    }

    public boolean isCritRateUseful() {
        return critRateUseful;
    }

    public void setCritRateUseful(boolean critRateUseful) {
        this.critRateUseful = critRateUseful;
    }

    public boolean isDefenseUseful() {
        return defenseUseful;
    }

    public void setDefenseUseful(boolean defenseUseful) {
        this.defenseUseful = defenseUseful;
    }

    public boolean isRechargeUseful() {
        return rechargeUseful;
    }

    public void setRechargeUseful(boolean rechargeUseful) {
        this.rechargeUseful = rechargeUseful;
    }

    public Double getResistance() {
        return resistance;
    }

    public void setResistance(Double resistance) {
        this.resistance = resistance;
    }

    public String getSuit() {
        return suit==null?"":suit;
    }

    public void setSuit(String suit) {
        this.suit = suit;
    }

    public int getSandType() {
        return sandType;
    }

    public void setSandType(int sandType) {
        this.sandType = sandType;
    }

    public int getCupType() {
        return cupType;
    }

    public void setCupType(int cupType) {
        this.cupType = cupType;
    }

    public int getCirclet() {
        return circlet;
    }

    public void setCirclet(int circlet) {
        this.circlet = circlet;
    }

    public int getWeapon() {
        return weapon;
    }

    public void setWeapon(int weapon) {
        this.weapon = weapon;
    }

    public Double getReaction() {
        return reaction;
    }

    public void setReaction(Double reaction) {
        this.reaction = reaction;
    }

    public Double getReactionIncrease() {
        return reactionIncrease;
    }

    public void setReactionIncrease(Double reactionIncrease) {
        this.reactionIncrease = reactionIncrease;
    }

    @Override
    public String toString() {
        return "totalDmg=" + totalDmg +
                ", description='" + description +'\''+
                ", hp=" + hp +
                ", hp_ex=" + hp_ex +
                ", atk=" + atk +
                ", atk_ex=" + atk_ex +
                ", critRate=" + critRate +
                ", critDmg=" + critDmg +
                ", defense=" + defense +
                ", defense_ex=" + defense_ex +
                ", healingBonus=" + healingBonus +
                ", increase=" + increase +
                ", recharge=" + recharge +
                ", skillDmg=" + skillDmg +
                ", mastery=" + mastery +
                ", subStatProperties=" + subStatProperties.toString() +
                '}';
    }
    public Scene toScene(){
        Scene scene = new Scene();
        scene.setAtk((int) (atk+atk_ex));
        scene.setCritDmg(critDmg);
        scene.setCritRate(critRate);
        scene.setHp((int) (hp+hp_ex));
        scene.setIncrease(increase);
        scene.setSceneDesc(description);
        scene.setDefense(defense.intValue());
        scene.setMastery(mastery);
        scene.setRecharge(recharge);
        scene.setTotalDmg(totalDmg);
        scene.setSands(sandType);
        scene.setCup(cupType);
        scene.setCirclet(circlet);
        scene.setSuit(suit);
        scene.setWeapon(weapon);
        scene.setWeaponRefineLevel(weaponRefineLevel);
        scene.setRole(role);

        scene.setRemark(String.valueOf(enemy.getElementstate()));
        setSubStateProperties(scene);
        return scene;
    }

    private void setSubStateProperties(Scene scene) {
        scene.setSubAtk(subStatProperties.atk);
        scene.setSubRate(subStatProperties.critRate);
        scene.setSubDmg(subStatProperties.critDmg);
    }

    public int getWeaponRefineLevel() {
        return weaponRefineLevel;
    }

    public void setWeaponRefineLevel(int weaponRefineLevel) {
        this.weaponRefineLevel = weaponRefineLevel;
    }
}
